package cn.edu.ctbu.lablist.service;

import cn.edu.ctbu.lablist.domain.Student;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface StudentService {


    /**
     * 查询所有学生信息
     * @return
     */
    public List<Student> findAll();
    /**
     * 只分页的查询
     * @param pageable
     * @return
     */
    public Page<Student> findAll(Pageable pageable);
    /**
     *分页，带过滤的查询
     * @param student
     * @param pageable
     * @return
     */
    public Page<Student> findAll(Example<Student> student,Pageable pageable);
    /**
     * 按id进行查询
     * @param id 主键，整数
     * @return
     */
    public Student findById(Integer id);
    public Student getById(Long id);
    /**
     * 按名字进行查询,Like
     * @param name 字符串
     * @return
     */
    public List<Student> findByName(String name);
    /**
     * 按学号查询
     * @param no
     * @return
     */
    public List<Student> findByNo(String no);
    /**
     * 按名字和密码查询
     * @param name
     * @param password
     * @return
     */
    public List<Student> findByNameAndPassword(String name,String password);
    /**
     * 按学号和密码查询
     * @param no
     * @param password
     * @return
     */
    public List<Student> findByNoAndPassword(String no,String password);
    /**
     * 插入学生信息
     *
     * @param student
     * @return
     */
    public Student insert(Student student);
    public Student add(Student student);
    /**
     * 修改学生信息
     *
     * @param student
     * @return
     */
    public Student update(Student student);
    /**
     * 删除学生信息
     * @param id
     */
    public void delete(Long id);
    public Student delete(Student student);
    /**
     * 验证用户名和密码，如果通过，返回读取的学生
     * @param username
     * @param password
     */
    public Student validateUsernameAndPassword(String username,String password) throws Exception;

}
